09. Quizzes: Additional Unit Test Topics

Quizzes: Additional Unit Test Topics

Which of these tests does the best job of testing if our addTwoNumbers method can add 6 to things:

SOLUTION: ``` @ParameterizedTest(name = "[{index}] {0} + {1} = {2}") @CsvSource({ "6, 5, 11", "6, 1, 7", "6, 100, 106", "6, 1000, 1006", "6, 100000, 100006" }) public void addTwoNumbers_addSix_returnsNumberPlusSix(int input1, int input2, int expected) { App app = new App(); Assertions.assertEquals(expected, app.addTwoNumbers(input1, input2)); } ```

QUIZ QUESTION::

Which step in the Unit Test Lifecycle would be good for each of these actions:

ANSWER CHOICES:



Action

Lifecycle Step

Initializing the Class Under Test

Establishing a Database Connection

Deleting Files Created By a Test

Shut Down Connection to a Server

SOLUTION:

Action

Lifecycle Step

Deleting Files Created By a Test

Establishing a Database Connection

Shut Down Connection to a Server

Initializing the Class Under Test